<template>
  <div class="analyse">
    <el-table
      v-loading="listLoading"
      :data="list"
      element-loading-text="Loading"
      border
      fit
      highlight-current-row>
      <el-table-column label="时间" align="center" width="200">
        <template slot-scope="scope">
          <i class="el-icon-time"/>
          <span>{{ scope.row.time | dateFilter }}</span>
        </template>
      </el-table-column>
      <el-table-column label="用户ID" align="center" width="95">
        <template slot-scope="scope">
          {{ scope.row.id }}
        </template>
      </el-table-column>
      <el-table-column label="用户名" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.name }}</span>
        </template>
      </el-table-column>
      <el-table-column label="花费金额(DLB)" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.account }}</span>
        </template>
      </el-table-column>
      <el-table-column label="分析类型" align="center">
        <template slot-scope="scope">
          <el-tag :type="scope.row.status==1?'':scope.row.status==2?'success':'warning'" size="medium">{{ scope.row.statusText }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="账户余额(DLB)" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.account }}</span>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.currentPages" :limit.sync="listQuery.pageSize" align="center" @pagination="fetchData" />
  </div>
</template>

<script>
// import { getList, delArticle } from '@/api/table'
import Pagination from '@/components/Pagination'
import { formatTime } from '@/utils/index'
export default {
  components: { Pagination },
  filters: {
    dateFilter(time) {
      return formatTime(time, 'yyyy-MM-dd HH:mm:ss')
    }
  },
  data() {
    return {
      list: null,
      listLoading: false,
      total: 0,
      listQuery: {
        currentPages: 1,
        pageSize: 10
      }
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      // this.listLoading = true
      // getList(this.listQuery).then(response => {
      //   this.list = response.data.dataList
      //   this.total = response.data.totalElements
      //   setTimeout(() => {
      //     this.listLoading = false
      //   }, 1.5 * 1000)
      // })

      this.list = [
        {
          id: '1',
          name: 'baiyu',
          account: 1235.5,
          time: '1560441600',
          address: '122122212212121',
          status: 1,
          statusText: 'CIBN影视'
        },
        {
          id: '1',
          name: 'baiyu',
          account: 1235.5,
          time: '1560441600',
          address: '122122212212121',
          status: 2,
          statusText: '医疗健康'
        },
        {
          id: '1',
          name: 'baiyu',
          account: 1235.5,
          time: '1560441600',
          address: '122122212212121',
          status: 3,
          statusText: 'DLB阅读宝'
        }
      ]
    }
  }
}
</script>
